// import {BrowserRouter as Router, Switch, Route} from 'react-router-dom'
import {HashRouter as Router, Switch, Route} from 'react-router-dom'
import Home from '../pages/Home'
import Fast from '../pages/Fast'
import User from '../pages/User'
import Login from '../pages/Login'
import Register from '../pages/Register'
import Category from '../pages/Category'
import Toggle from '../pages/Toggle'
import Practice from '../pages/Practice'
import App from '../App'

// 声明一个路由函数(组件)
const BaseRouter = () => (
    <Router>
        <Switch>
            <Route path="/" component={() => (
                <App>
                    <Switch>
                        <Route exact path="/home" component={Home}></Route>
                        <Route exact path="/fast" component={Fast}></Route>
                        <Route exact path="/user" component={User}></Route>
                        <Route exact path="/login" component={Login}></Route>
                        <Route exact path="/register" component={Register}></Route>
                        <Route exact path="/practice" component={Practice}></Route>
                        <Route exact path="/category/:code" component={Category}></Route>
                        <Route exact path="/toggle/:actionCode" component={Toggle}></Route>
                    </Switch>
                </App>
            )}></Route>
        </Switch>
    </Router>
)

export default BaseRouter;